/*
 * Timer.h
 *
 *  Created on: 04.05.2011
 *      Author: Hugme
 */

#ifndef TIMER_H_
#define TIMER_H_
#define CODE_TIMER 1

#include <time.h>
#include <sys/siginfo.h>
#include <errno.h>
#include <sys/neutrino.h>
#include <stdio.h>
#include <stdlib.h>

class Timer{
	public:
		void addTimer(int chid, int sec, int nsec, int intervallSec, int intervallNsec);
		struct itimerspec* getRemainingTime(int timerID);
		int restartTimer(int timerID);
		struct itimerspec* abortTimer(int timerID);
		struct itimerspec* pauseTimer(int timerID);
		int resumeTimer(struct itimerspec*);
		int getTimerID();
	private:
		timer_t timerid; // timer ID for timer
		struct sigevent event; // event to deliver
		struct itimerspec timer; // the timer data structure
		struct itimerspec remainingTime;
		int chid;
		int sec;
		int nsec;
		int intervallSec;
		int intervallNsec;
		int coid; // connection back to ourselves
};

#endif /* TIMER_H_ */
